package cn.laixueit.cart.service.impl;

import cn.laixueit.mapper.SpecParamsMapper;
import cn.laixueit.cart.pojo.item.SpecParams;
import cn.laixueit.cart.service.SpecParamsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.HashMap;

@Service
public class SpecParamsServiceImpl extends ServiceImpl<SpecParamsMapper, SpecParams> implements SpecParamsService {


    @Override
    public Collection<SpecParams> findSpecParams(Long gid, Long cid,Boolean searching,Boolean generic) {
        HashMap<String, Object> map = new HashMap<>();
        if(gid != null){
            map.put("group_id",gid);
        }
        if (cid != null) {
            map.put("cid",cid);
        }

        if(searching){
            map.put("searching",searching);
        }
        if(generic != null){
            map.put("generic",generic);
        }
        Collection<SpecParams> specParams = listByMap(map);
        return specParams;
    }
}
